package model;

public class OrderDetail {
    private MenuItem item;
    private int quantity;

    public OrderDetail(MenuItem item, int quantity) {
        this.item = item;
        this.quantity = quantity;
    }

    // Getters and Setters
    public MenuItem getItem() {
        return item;
    }

    public void setItem(MenuItem item) {
        this.item = item;
    }

    public int getQuantity() { // 修复：添加 getQuantity 方法
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    // 获取订单详情的总价（单项价格）
    public double getTotalPrice() {
        return item.getPrice() * quantity; // 单价 × 数量
    }
}
